class IndexServe {

    async info(data = {}, headers = {}) {
        let http = new Http();
        let res =  await http.get({
            url: config.urlList.info,
            data,
            headers
        });
        http = null;
        return res;
    }

    async classList(data = {}, headers = {}) {
        let http = new Http();
        let res =  await http.get({
            url: config.urlList.classList,
            data,
            headers
        });
        http = null;
        return res;
    }

    async index(data = {}, headers = {}) {
        let http = new Http();
        let res = await http.get({
            url: config.urlList.index,
            data,
            headers
        });
        http = null;
        return res;
    }

    async type(data = {}, headers = {}) {
        let http = new Http();
        let res =  await http.get({
            url: config.urlList.type,
            data,
            headers
        });
        res.principal.unshift({
            id: -1,
            page: -1,
            title: "首页"
        });
        res.principal.forEach(v => {
            v.content = []
            v.total_page = 0
        });

        res.additional.forEach(v => {
            v.content = []
            v.total_page = 0
        });
        http = null;
        return res;
    }

}

var indexServe = new IndexServe()